package ac.svn.accesscontrol.lnf;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.RadialGradientPaint;
import java.awt.RenderingHints;
import java.awt.geom.Point2D;
import java.awt.geom.RoundRectangle2D;

import javax.swing.JComponent;
import javax.swing.plaf.LabelUI;

public class ALabelUI extends LabelUI 
{

    Color light = new Color(0xCAE1FF);//CAE1FF
    Color dark  = new Color(0xA2B5CD); //A2B5CD	

    /* (non-Javadoc)
     * @see javax.swing.plaf.ComponentUI#paint(java.awt.Graphics, javax.swing.JComponent)
     */
    @Override
    public void paint(Graphics g, JComponent comp) {
	Graphics2D g2 = (Graphics2D) g;

	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	GradientPaint p;
	p = new GradientPaint(0, 0, light,
		0, comp.getHeight()/4, dark);

	Paint oldPaint = g2.getPaint();
	g2.setPaint(p);

	g2.fill(new RoundRectangle2D.Double(0,0,comp.getWidth(),comp.getHeight(),5,5));


	g2.setColor(Color.GREEN);
	/*g2.setStroke(new BasicStroke(2));
	    g2.draw(new RoundRectangle2D.Double(0,0,getWidth()- 1,getHeight()-1,0,0));*/

	Paint radical = new RadialGradientPaint(new Point2D.Double(comp.getWidth() / 2.0,
		comp.getHeight()), comp.getWidth(),
		new float[] { 0.0f, 0.5f ,1.0f },
		new Color[] {light.brighter(),dark,dark.darker()});
	g2.setPaint(radical);

	g2.fill(new RoundRectangle2D.Double(0,0,comp.getWidth(),comp.getHeight(),5,5));


	g2.setPaint(oldPaint);
	super.paint(g, comp);
    }
}
